﻿using Jay.Sc2.Bof.Lib.State;
using Jay.Sc2.Bof.Lib.Tools;

namespace Jay.Sc2.Bof.Lib.Action.Zerg
{
	public class ActionProduceDrone : ActionProduceFromLarva
	{
		public static ActionProduceDrone Instance = new ActionProduceDrone();
		protected ActionProduceDrone() : base(17, 50, 0, 1) { }
		public override bool CanExecute(IBuildOrder bo)
		{
			return bo.State.Workers < IncomeUtil.GetSaturationWorkerCount(bo.State.MineralPatches, bo.State.GasBuilding.Count) && base.CanExecute(bo);
		}
		public override bool HaveTechnology(IBuildOrder bo) { return true; }
		public override void OnProductionStarted(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			state.Drone_Building++;
		}
		public override void OnProductionFinished(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			state.Drone++;
			state.Drone_Building--;
			state.WorkersOnMinerals++;
		}
		public override string EventName { get { return "ActionSpawnDrone"; } }
	}
}
